// src/stores/FormStore.ts
import { defineStore } from 'pinia'

interface FormData {
  numPeople: number
  avgAge: number
  destination: string
  days: number
  travelStyle: string
  budget: string
  preferences: string[]
}

export const useFormStore = defineStore('form', {
  state: () => ({
    lastFormData: null as FormData | null
  }),

  actions: {
    setFormData(data: FormData) {
      this.lastFormData = data
    },

    // 转换预算等级
    mapBudget(budget: string, isToAIRecommendation: boolean) {
      const budgetMap = {
        // AIRecommendation -> AISuggestion
        budget: 'economic',
        moderate: 'moderate', 
        luxury: 'luxury',
        // AISuggestion -> AIRecommendation
        economic: 'budget',
        // moderate 和 luxury 保持不变
      }
      return budgetMap[budget] || budget
    },

    // 转换出行风格
    mapTravelStyle(style: string, isToAIRecommendation: boolean) {
      const styleMap = {
        // AIRecommendation -> AISuggestion
        relaxation: 'relaxed',
        culture: 'cultural',
        adventure: 'adventurous',
        // AISuggestion -> AIRecommendation  
        relaxed: 'relaxation',
        cultural: 'culture',
        adventurous: 'adventure'
      }
      return styleMap[style] || style
    }
  }
})